package com.own.business.dingtalk.gov.entity.dto;

import com.own.business.dingtalk.gov.entity.bo.DingTalkGovUserBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * DingTalkGovUserDto
 *
 * @author chenxueli
 * @date 2023-07-02 13:11:29
 */
@Schema(title = "政务钉钉用户" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class DingTalkGovUserDto extends BaseDto<DingTalkGovUserBo> implements Serializable {

    @Schema(title = "账号名")
    private String account;

    @Schema(title = "账号id")
    private Long accountId;

    @Schema(title = "应用名")
    private String clientId;

    @Schema(title = "租户下人员编码")
    private String employeeCode;

    @Schema(title = "姓名")
    private String lastName;

    @Schema(title = "账号类型")
    private String namespace;

    @Schema(title = "昵称")
    private String nickNameCn;

    @Schema(title = "租户id")
    private Long realmId;

    @Schema(title = "租户名称")
    private String realmName;

    @Schema(title = "租户+用户唯一标识")
    private String tenantUserId;

    @Schema(title = "应用+用户唯一标识")
    private String openid;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public DingTalkGovUserBo toBo(DingTalkGovUserBo entity) {
        if (entity == null) {
            entity = new DingTalkGovUserBo();
        }
        entity.setAccount(account);
        entity.setAccountId(accountId);
        entity.setClientId(clientId);
        entity.setEmployeeCode(employeeCode);
        entity.setLastName(lastName);
        entity.setNamespace(namespace);
        entity.setNickNameCn(nickNameCn);
        entity.setRealmId(realmId);
        entity.setRealmName(realmName);
        entity.setTenantUserId(tenantUserId);
        entity.setOpenid(openid);
        return super.toBo(entity);
    }

}
